using Microsoft.Practices.Composite.Events;
using StockholmsStad.Windows.UI.Modules.Ceremony.Interfaces;
using StockholmsStad.Windows.UI.Modules.Ceremony.Models;

namespace StockholmsStad.Windows.UI.Modules.Ceremony.Presenters
{
    public class CeremonyPresenter
    {
        private readonly ICeremonyListPresenter listPresenter;
        private readonly ICeremonyController ceremonyController;
        
        public CeremonyPresenter(ICeremonyView view, ICeremonyListPresenter presenter, ICeremonyController controller)
        {
            View = view;
            ceremonyController = controller;
            listPresenter = presenter;
            listPresenter.CeremonySelected += listPresenter_CeremonySelected;
            View.SetContent(listPresenter.View);
        }

        private void listPresenter_CeremonySelected(object sender, DataEventArgs<CeremonySummaryPresentationModel> e)
        {
            ceremonyController.OnCeremonySelected(e.Value);
        }

        public ICeremonyView View { get; private set; }

    }
}